package datastructures;

public class Instruction {
	
	int id;
	int immediate;
	int op1, op2, op3;
	int reservationStationIndex, robIndex;
	int finishedStages = 0;
	int executionTime, executedcycles = 0;


	String type;
	
	public Instruction(int id, String type, int op1, int op2, int op3, int immediate) {

		this.id = id;
		this.type = type;
		this.op1 = op1;
		this.op2 = op2;
		this.op3 = op3;
		this.immediate = immediate;
		
	}
	
	
	
	public int getImmediate() {
		return immediate;
	}



	public int getOp1() {
		return op1;
	}



	public int getOp2() {
		return op2;
	}



	public int getOp3() {
		return op3;
	}



	public String getType() {
		return type;
	}



	public void setType(String type) {
		this.type = type;
	}
	
	
	public int getReservationStationIndex() {
		return reservationStationIndex;
	}



	public void setReservationStationIndex(int reservationStationIndex) {
		this.reservationStationIndex = reservationStationIndex;
	}



	public int getRobIndex() {
		return robIndex;
	}



	public void setRobIndex(int robIndex) {
		this.robIndex = robIndex;
	}



	public int getFinishedStages() {
		return finishedStages;
	}



	public void setFinishedStages(int finishedStages) {
		this.finishedStages = finishedStages;
	}



	public int getExecutionTime() {
		return executionTime;
	}



	public void setExecutionTime(int executionTime) {
		this.executionTime = executionTime;
	}



	public int getExecutedcycles() {
		return executedcycles;
	}



	public void setExecutedcycles(int executedcycles) {
		this.executedcycles = executedcycles;
	}


	

	public String toString(){
		
		String result = " i" + id + ": " + type + " R" + op1 + " ";
		
		if(op2 != -1)
			result += ("R"+op2+ " ");
		
		if(op3 != -1)
			result += ("R" +op3 + " ");
		
		if(immediate != 0)
			result += (immediate + " ");
		
		return(result);
		
	}
	
	

}
